//
//  BHStadiumDetailModel.swift
//  BigHealth
//
//  Created by 布丁 on 2021/7/30.
//

import UIKit

class BHStadiumDetailModel {
    var stadiumId: String = ""
    var name: String = ""
    var cover: String = ""
    var cityName: String = ""
    var regionName: String = ""
    var startTime: String = ""
    var endTime: String = ""
    var address: String = ""
    var contacts: String = ""
    var contactNumber: String = ""
    var introduce: String = ""
    var viewCount: String = ""
    
    var imageModelArray: [BHImageOrVideoModel] = []
    
    
    var ifAttention: Int = 0 // 是否关注 1已关注 0未关注

    fileprivate var canFlagIntroduce: Bool = false
    
    func parseDic(_ dic: [String:Any]) {
        self.stadiumId = BHJsonTool.decodeStringFromDic(dic: dic, key: "id")
        self.name = BHJsonTool.decodeStringFromDic(dic: dic, key: "name")
        self.cover = BHJsonTool.decodeStringFromDic(dic: dic, key: "cover")
        self.cityName = BHJsonTool.decodeStringFromDic(dic: dic, key: "cityName")
        self.regionName = BHJsonTool.decodeStringFromDic(dic: dic, key: "regionName")
        self.startTime = BHJsonTool.decodeStringFromDic(dic: dic, key: "startTime")
        self.endTime = BHJsonTool.decodeStringFromDic(dic: dic, key: "endTime")
        self.address = BHJsonTool.decodeStringFromDic(dic: dic, key: "address")
        self.contacts = BHJsonTool.decodeStringFromDic(dic: dic, key: "contacts")
        self.contactNumber = BHJsonTool.decodeStringFromDic(dic: dic, key: "contactNumber")
        self.introduce = BHJsonTool.decodeStringFromDic(dic: dic, key: "introduce")
        self.viewCount = BHJsonTool.decodeStringFromDic(dic: dic, key: "viewCount")

        self.ifAttention = BHJsonTool.decodeIntFromDic(dic: dic, key: "ifAttention")
        
        let image = BHJsonTool.decodeArrayFromDic(dic: dic, key: "images")
        if self.imageModelArray.count != 0 {
            self.imageModelArray.removeAll()
        }
        
        for url in image {
            if url is NSNull {
                continue
            }else {
                let model = BHImageOrVideoModel.init()
                model.imageUrl = url as? String
                self.imageModelArray.append(model)
            }
        }
    }
    
}
